package com.zhousb.deviceManager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhousb.deviceManager.mapper.ClientMapper;
import com.zhousb.deviceManager.model.entity.KtClient;
import com.zhousb.deviceManager.model.so.SimpleSo;
import com.zhousb.deviceManager.service.ClientService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class ClientServiceImpl implements ClientService {

    @Resource
    private ClientMapper clientMapper;
    @Override
    public Page<KtClient> page(Page<KtClient> page, SimpleSo so) {
        LambdaQueryWrapper<KtClient> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(StringUtils.hasText(so.getKeyword()),KtClient::getClientName,so.getKeyword());
        return clientMapper.selectPage(page,queryWrapper);
    }
}
